package com.ruoyi.common.enums;

public enum TxnTypeGroup {
    ALL(0, "全部"),
    RECHARGE(1, "充值"),
    WITHDRAW(2, "提币"),
    TRADE(3, "交易"),
    ;

    /**
     * 流水类型编码
     */
    private int code;
    /**
     * 流水类型名称
     */
    private String name;

    TxnTypeGroup(int code, String name) {
        this.code = code;
        this.name = name;
    }

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    public static TxnTypeGroup getByCode(int code) {
        TxnTypeGroup[] array = TxnTypeGroup.values();
        TxnTypeGroup temp = null;
        for (int i = 0; i < array.length; i++) {
            temp = array[i];
            if (code == temp.getCode()) {
                return temp;
            }
        }
        return null;
    }
}
